package cl.zeke.cursos.jsf2spring3jpa2.negocio.services;

import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Service;

@Service
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
public class CalculadoraService {
    
    public double sumar(double a, double b) {
        return a+b;
    }
    
    public double restar(double a, double b) {
        return a-b;
    }
    
    public double multiplicar(double a, double b) {
        return a*b;
    }
    
    public double dividir(double a, double b) {
         if (b == 0) {
            throw new ArithmeticException("Division por 0");
        }
        return a/b;
    }
    
}
